<?php 
	/**
	* xmlToString()转数组业务逻辑
	*/
	header("Content-Type:text/html;charset=utf-8");
	include_once('Base.class.php');
	class xmlQuestion extends Base
	{
		
		public function __construct($xmlStr)
		{
			$this->pri($this->xmlToString($xmlStr));
		}

		public function xmlToString($xml){
			libxml_disable_entity_loader(true); 
  
			$xmlstring = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA); 
			 
			$val = json_decode(json_encode($xmlstring),true); 
			 
			return $val; 
			 
		}

	}

	$xmlStr = '<?xml version="1.0" encoding="utf-8"?>
		<books>
		<bookinfo>
		<id>166567</id>
		<bookName><![CDATA[霸道邪尊]]></bookName>
		<subTitle><![CDATA[ 神龙之力觉醒:霸道邪尊]]></subTitle> <detail><![CDATA[最为强大的中立势力龙神殿，数千年前被人阴谋篡位，龙神殿正统后裔何时回归？]]></detail>
		<keyWord><![CDATA[玄幻,觉醒,龙之力]]></keyWord>
		<author><![CDATA[木杉树]]></author>
		<price>10</price>
		</bookinfo>
		</books>';
	$xml = new xmlQuestion($xmlStr);
 ?>